package String.homework;
/**
 * @author Justin Parker
 * @author   2024/7/11 下午10:18
 * @version 1.0
 */
public class Test01 {
    public static void main(String[] args){
        String src1 = "logo.png";
        String src2 = "jquery.1.1.2.js";

        String ext = getExtByName(src1);
        System.out.println(ext);
        ext = getExtByName(src2);
        System.out.println(ext);

    }

    /**
     * 获取给定文件名中的后缀名部分
     * @param name
     * @return
     */

    public static String getExtByName(String name){
        int index = name.lastIndexOf(".")+1;
        String sub = name.substring(index);
        return sub;
    }
}
